| Miles Sound System SDK 7.2a |
Read this section carefully if you plan to use Miles timer or other callbacks (such as an end-of-sample callback). If you don't intend to use callbacks, then this section won't apply to you.
Under Win64, callbacks are usually made to your application on a background thread. The ideal callback function is one that does nothing more than write to one or two flag variables and then immediately return back to Miles. Under Win64, other operations are allowed, but not recommended!
So, unlike MacOS 9, Wii or PS2, you can do whatever you want inside a Miles callback under Win32 - there are no OS-mandated restrictions. However, if you want to maintain easily ported code, then you should read about the callback restrictions for the other platforms you intend to support. Other platforms are much more strict than Win64 when it comes to callbacks.
In any case, you do have to take general multithread precautions in your callbacks. For example, if you use the C runtime library inside a callback, then you need to link with the multithreaded libraries. If you access your own internal data structures, then you need to make sure that the accessor functions can be called by two threads at once (unless you protect with a critical section lock).
Also remember that all global or static variables that are modified by a callback function must be declared with the volatile modifier. Otherwise, the callback function and the foreground may not be able to communicate after the compiler has performed all of its optimizing tricks.
You should also minimize the total amount of work inside a Miles callback. During a callback, Miles is suspended, so other background tasks won't run - mixing will be interrupted, for example, if you take too long.
Again, though, the best advice for callbacks is to simply post a message or set a flag that can be operated on by your foreground task. This technique works on all platforms and you'll never need to worry about the complications that multithreading can cause.
Next Topic (Sharing the CPU under Win64)
Previous Topic (Memory management under Win64)
Group:
Overview for Win64: Miles on Windows 64 XP and Vista
Related FAQs:
What's the deal with callbacks - are they threads, interrupts, system timers, or what?
For technical support, e-mail Miles3@radgametools.com
© Copyright 1991-2007 RAD Game Tools, Inc. All Rights Reserved.